﻿using DataTurnClient.Enum;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using SqlSugar;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace DataTurnClient.Model
{
    public class GetSetting : INotifyPropertyChanged
    {
        [JsonProperty("session")]
        public List<Session> session
        {
            get => _sessions;
            set
            {
                _sessions = value;
                NotifyPropertyChanged();
            }
        }
        private List<Session> _sessions;

        public int timer
        {
            get => _timer;
            set
            {
                _timer = value;
                NotifyPropertyChanged();
            }
        }
        private int _timer;

        public int log
        {
            get => _log;
            set
            {
                _log = value;
                NotifyPropertyChanged();
            }
        }
        private int _log;

        public DatabaseSet database
        {
            get => _database;
            set
            {
                _database = value;
                NotifyPropertyChanged();
            }
        }
        private DatabaseSet _database;

        public ding dingset
        {
            get => _dingset;
            set
            {
                _dingset = value;
                NotifyPropertyChanged();
            }
        }
        private ding _dingset;

        public event PropertyChangedEventHandler PropertyChanged;

        private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); //实现通知刷新
        }
    }
    public class Session : INotifyPropertyChanged
    {
        public int id
        {
            get => _id;
            set
            {
                _id = value;
                NotifyPropertyChanged();
            }
        }
        private int _id;

        public string ip
        {
            get => _ip;
            set
            {
                _ip = value;
                NotifyPropertyChanged();
            }
        }
        private string _ip;

        public string port
        {
            get => _port;
            set
            {
                _port = value;
                NotifyPropertyChanged();
            }
        }
        private string _port;

        public string path
        {
            get => _path;
            set
            {
                _path = value;
                NotifyPropertyChanged();
            }
        }
        private string _path;

        public event PropertyChangedEventHandler PropertyChanged;

        private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); //实现通知刷新
        }
    }

    public class DatabaseSet : INotifyPropertyChanged
    {
        public string connect
        {
            get => _connect;
            set
            {
                _connect = value;
                NotifyPropertyChanged();
            }
        }
        private string _connect;

        public DbType db
        {
            get => _db;
            set
            {
                _db = value;
                NotifyPropertyChanged();
            }
        }
        private DbType _db;

        public event PropertyChangedEventHandler PropertyChanged;

        private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); //实现通知刷新
        }
    }

    public class ding : INotifyPropertyChanged
    {
        public int on
        {
            get => _on;
            set
            {
                _on = value;
                NotifyPropertyChanged();
            }
        }
        private int _on;

        public string url
        {
            get => _url;
            set
            {
                _url = value;
                NotifyPropertyChanged();
            }
        }
        private string _url;

        public string safecode
        {
            get => _safecode;
            set
            {
                _safecode = value;
                NotifyPropertyChanged();
            }
        }
        private string _safecode;

        public event PropertyChangedEventHandler PropertyChanged;

        private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); //实现通知刷新
        }
    }
}
